<template>
  <div>
    <el-row>
      <el-col :span="24">
        <van-nav-bar
          title="设置"
          left-text="返回"
          left-arrow
          @click-left="onClickLeft"
        />
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24" id="i1">
        <van-cell title="个人资料" to="personalProfile"><span> > </span></van-cell>
        <van-cell title="账号与安全" @click="zhangHao()"><span> > </span></van-cell>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24" id="i1">
        <van-cell title="隐私协议" to="/yinSi"><span> > </span></van-cell>
        <van-cell title="用户服务协议" to="/fuWu"> <span> > </span></van-cell>
        <van-cell title="清理本地缓存" @click="clearCache"><span> > </span>
        </van-cell>
        <van-cell title="关于我们" to="me"><span> > </span></van-cell>
      </el-col>
<!--      <van-cell title="退出登录" is-link @click="logout" class="logout-cell"></van-cell>-->
      <van-button @click="logout" type="info" block>退出登录</van-button>
    </el-row>
  </div>
</template>

<script>
import {Toast} from "vant";
import axios from "axios";

export default {
  data() {
    return {
      product: {}
    };
  },
  methods: {
    onClickLeft() {
      Toast('返回');
      //返回上一个页面
      this.$router.push('/myShow');
    },
    zhangHao(){
      this.$router.push('/zhangHao');
    },
    clearCache() {
      // 在这里实现清理本地缓存的逻辑，例如调用相关方法清除缓存数据
      // 可以使用localStorage.clear()或其他缓存清理操作
      console.log('开始清理本地缓存');
    },
    logout() {
      // 在这里实现退出登录的逻辑，例如清除本地存储的登录信息，调用登出接口等
      localStorage.removeItem("user")
      this.$router.push('/');
    }
  },
  mounted() {
    var goods = localStorage.getItem('goodsXq');
    if (goods) {
      this.product = JSON.parse(goods);
      console.log("product=", goods);
    }
  }
};
</script>

<style>
#i1{
  text-align: left;
}

</style>
